<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<h3>
	<s:text name="page.heading.addnew" />
</h3>
<s:actionerror />

<s:form action="save" namespace="/timer" method="post"
	cssClass="form-horizontal" theme="simple">
	<s:hidden name="mode" />
	<s:actionerror cssClass="alert alert-error"/>
	<s:actionmessage cssClass="alert alert-success"/>
	<s:hidden name="timerSetting.timer.id" />
	<div class="control-group">
		<label class="control-label" for="timerSetting.timer.name"><s:text
				name="timer.label" /></label>
		<div class="controls">
			<s:textfield name="timerSetting.timer.name" cssClass="form-control"
				placeholder="%{getText('timer.label.placeholder')}" required="true" />
		</div>
	</div>

	<div class="control-group">
		<label class="control-label"><s:text name="timer.switch" /></label>
		<div class="controls">
			<s:select name="timerSetting.timer.switchId" list="switchList"
				listKey="id" listValue="name" value="timerSetting.switches.id" />
			<%-- <s:select name="timer.switchId" list="switchList"
												listKey="id" listValue="name"
												value="timerSetting.switches.id" /> --%>
		</div>
	</div>

	<div class="control-group">
		<label class="control-label"><s:text name="timer.time" /></label>
		<div class="controls">
			<s:select cssClass="span2" list="time_hour" name="selected_hour"
				id="timename" value="hour" />
			:
			<s:select cssClass="span2" name="selected_min" list="time_min"
				value="min" />
		</div>
	</div>

	<div class="control-group">
		
		<label class="control-label"><s:text name="timer.repeat" /></label>
		
		<div class="controls">
			<s:iterator value="%{selectedWeekList}" status="rowNumber">
				<label class="checkbox inline">
				<input type="checkbox" name="selectedDays"
					value="<s:property value='%{value}' />"
					<s:property value='%{state}' /> />
				 <s:property value="%{name}" />
				</label>
			</s:iterator><br><div>
			<a onclick="selectAll()"><s:text name="timer.selectall" /></a> | <a onclick="deselectAll()"><s:text name="timer.clear" /></a>
		</div>
	</div>
			<%-- <div class="controls">
--%>		
		<%--	<s:checkboxlist list="selectedWeekList" name="selectedDays" value="value"
				label="%{getText('timer.repeat')}" labelposition="inline"
				theme="bootstrap"/>--%>
			<%-- <label class="control-label"><s:text name="timer.repeat" /></label>
		 --%>
		
				<!-- <br /> <a>全選択</a> | <a>全解除</a> -->
			<%-- <label class="control-label"><s:text name="timer.repeat" /></label>
		 --%>
		</div>
		
 		
				<s:radio name="timerSetting.timer.switchSetting" list="settingList"
					value="timerSetting.timer.switchSetting" labelposition="inline" theme="bootstrap" label="%{getText('timer.change')}"/>
			
		

		<div class="control-group">
			<label class="control-label"><s:text name="timer.status" /></label>
			<div class="controls">
				<label class="checkbox inline">
					<s:checkbox name="timerStatus" value="timerSetting.timer.status" fieldValue="1" />
				</label>
					
			</div>
		</div>
		<div class="form-actions">
			<s:submit cssClass="btn btn-primary"
				value="%{getText('timer.savechanges')}"></s:submit>
			<s:reset cssClass="btn" value="%{getText('timer.cancel')}"></s:reset>
		</div>
</s:form>
